package com.xiyin.poi.controller;

import com.xiyin.poi.service.impl.WordExportServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/poi")
public class ExportController {

    @Autowired
    private WordExportServiceImpl wordExportService;

    @GetMapping("/export")
    public String exportWord() throws IOException {
        Map<String, Object> data = new HashMap<>();
        String outputPath = "D:/poi/exported.docx";
        wordExportService.exportWord(outputPath, data);
        return "Word文件已成功导出至: " + outputPath;
    }
}
